$ () ->
	$("#create_btn").click (e) ->
		param=
			username:$("#username").val()
			password:$("#password").val()
			last_name:$("#last_name").val()
			first_name:$("#first_name").val()
			role_id:$("#role_id").val()

		$.post '/api/admin/user/add-user',param,(res) ->
			if res.status.errCode is 0
				alert "创建成功"
				window.location.href = '/admin/user/index'
			else
				alert res.status.message

	$("#cancel_btn").click (e) ->
		window.location.href = "/admin/user/index"